import request from '@/utils/request';
import moment from 'moment';

// 补偿报表列表
export async function queryStatement(params) {
  return request('/dp/report/getReportDataPage', {
    method: 'get',
    params,
  });
}

// 获取下拉库数据，到达航站和出发航站的
export async function queryCityInfo(params) {
  return request('/dp/sys/getSelectCityInfo', {
    method: 'get',
    params,
  })
}

// 标记和取消标记
export async function markItem(params) {
  return request('/dp/report/updateFlag', {
    method: 'post',
    params,
  })
}

// 导出报表
export async function exportChart(params) {
  delete params.payDate
  delete params.flightDate
  if (!params.flightStartDate && !params.flightEndDate) {
    params.flightStartDate = moment().format('YYYY-MM-DD');
    params.flightEndDate = moment().format('YYYY-MM-DD');
  }
  if (!params.payStartDate && !params.payEndDate) {
    params.payStartDate = moment().format('YYYY-MM-DD');
    params.payEndDate = moment().format('YYYY-MM-DD');
  }
  return request('/dp/report/exportData', {
    method: 'get',
    params,
    responseType: "blob"
  })
}

